home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / bin / gettextize < prev    next >
Encoding:
Text File  |  2008-03-13  |  41.0 KB  |  1,277 lines

  1. #! /bin/sh
  2. #
  3. # Copyright (C) 1995-1998, 2000-2007 Free Software Foundation, Inc.
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. #
  18.  
  19. # This file is meant for authors or maintainers which want to
  20. # internationalize their package with the help of GNU gettext.  For
  21. # further information how to use it consult the GNU gettext manual.
  22.  
  23. progname=$0
  24. package=gettext-tools
  25. version=0.17
  26.  
  27. # Set variables
  28. # - gettext_dir     directory where the sources are stored.
  29. prefix="/usr"
  30. datarootdir="${prefix}/share"
  31. gettext_dir="${datarootdir}/gettext"
  32.  
  33. # func_tmpdir
  34. # creates a temporary directory.
  35. # Sets variable
  36. # - tmp             pathname of freshly created temporary directory
  37. func_tmpdir ()
  38. {
  39.   # Use the environment variable TMPDIR, falling back to /tmp. This allows
  40.   # users to specify a different temporary directory, for example, if their
  41.   # /tmp is filled up or too small.
  42.   : ${TMPDIR=/tmp}
  43.   {
  44.     # Use the mktemp program if available. If not available, hide the error
  45.     # message.
  46.     tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
  47.     test -n "$tmp" && test -d "$tmp"
  48.   } ||
  49.   {
  50.     # Use a simple mkdir command. It is guaranteed to fail if the directory
  51.     # already exists.  $RANDOM is bash specific and expands to empty in shells
  52.     # other than bash, ksh and zsh.  Its use does not increase security;
  53.     # rather, it minimizes the probability of failure in a very cluttered /tmp
  54.     # directory.
  55.     tmp=$TMPDIR/gt$$-$RANDOM
  56.     (umask 077 && mkdir "$tmp")
  57.   } ||
  58.   {
  59.     echo "$0: cannot create a temporary directory in $TMPDIR" >&2
  60.     { (exit 1); exit 1; }
  61.   }
  62. }
  63.  
  64. # Support for relocatability.
  65. func_find_curr_installdir ()
  66. {
  67.   # Determine curr_installdir, even taking into account symlinks.
  68.   curr_executable="$0"
  69.   case "$curr_executable" in
  70.     */* | *\\*) ;;
  71.     *) # Need to look in the PATH.
  72.       if test "${PATH_SEPARATOR+set}" != set; then
  73.         func_tmpdir
  74.         { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
  75.         chmod +x "$tmp"/conf.sh
  76.         if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
  77.           PATH_SEPARATOR=';'
  78.         else
  79.           PATH_SEPARATOR=:
  80.         fi
  81.         rm -rf "$tmp"
  82.       fi
  83.       save_IFS="$IFS"; IFS="$PATH_SEPARATOR"
  84.       for dir in $PATH; do
  85.         IFS="$save_IFS"
  86.         test -z "$dir" && dir=.
  87.         for exec_ext in ''; do
  88.           if test -f "$dir/$curr_executable$exec_ext"; then
  89.             curr_executable="$dir/$curr_executable$exec_ext"
  90.             break 2
  91.           fi
  92.         done
  93.       done
  94.       IFS="$save_IFS"
  95.       ;;
  96.   esac
  97.   # Make absolute.
  98.   case "$curr_executable" in
  99.     /* | ?:/* | ?:\\*) ;;
  100.     *) curr_executable=`pwd`/"$curr_executable" ;;
  101.   esac
  102.   # Resolve symlinks.
  103.   sed_dirname='s,/[^/]*$,,'
  104.   sed_linkdest='s,^.* -> \(.*\),\1,p'
  105.   while : ; do
  106.     lsline=`LC_ALL=C ls -l "$curr_executable"`
  107.     case "$lsline" in
  108.       *" -> "*)
  109.         linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
  110.         case "$linkdest" in
  111.           /* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
  112.           *) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
  113.         esac ;;
  114.       *) break ;;
  115.     esac
  116.   done
  117.   curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
  118.   # Canonicalize.
  119.   curr_installdir=`cd "$curr_installdir" && pwd`
  120. }
  121. func_find_prefixes ()
  122. {
  123.   # Compute the original/current installation prefixes by stripping the
  124.   # trailing directories off the original/current installation directories.
  125.   orig_installprefix="$orig_installdir"
  126.   curr_installprefix="$curr_installdir"
  127.   while true; do
  128.     orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
  129.     curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
  130.     if test -z "$orig_last" || test -z "$curr_last"; then
  131.       break
  132.     fi
  133.     if test "$orig_last" != "$curr_last"; then
  134.       break
  135.     fi
  136.     orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
  137.     curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
  138.   done
  139. }
  140. if test "no" = yes; then
  141.   exec_prefix="${prefix}"
  142.   bindir="${exec_prefix}/bin"
  143.   orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
  144.   func_find_curr_installdir # determine curr_installdir
  145.   func_find_prefixes
  146.   # Relocate the directory variables that we use.
  147.   gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
  148. fi
  149.  
  150. # func_usage
  151. # outputs to stdout the --help usage message.
  152. func_usage ()
  153. {
  154.   echo "\
  155. Usage: gettextize [OPTION]... [package-dir]
  156.  
  157. Prepares a source package to use gettext.
  158.  
  159. Options:
  160.       --help           print this help and exit
  161.       --version        print version information and exit
  162.   -f, --force          force writing of new files even if old exist
  163.       --intl           install libintl in a subdirectory
  164.       --po-dir=DIR     specify directory with PO files
  165.       --no-changelog   don't update or create ChangeLog files
  166.       --symlink        make symbolic links instead of copying files
  167.   -n, --dry-run        print modifications but don't perform them
  168.  
  169. Report bugs to <bug-gnu-gettext@gnu.org>."
  170. }
  171.  
  172. # func_version
  173. # outputs to stdout the --version message.
  174. func_version ()
  175. {
  176.   echo "$progname (GNU $package) $version"
  177.   echo "Copyright (C) 1995-1998, 2000-2007 Free Software Foundation, Inc.
  178. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  179. This is free software: you are free to change and redistribute it.
  180. There is NO WARRANTY, to the extent permitted by law."
  181.   echo "Written by" "Ulrich Drepper"
  182. }
  183.  
  184. # func_fatal_error message
  185. # outputs to stderr a fatal error message, and terminates the program.
  186. func_fatal_error ()
  187. {
  188.   echo "gettextize: *** $1" 1>&2
  189.   echo "gettextize: *** Stop." 1>&2
  190.   exit 1
  191. }
  192.  
  193. # Nuisances.
  194. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  195.  
  196. # Command-line option processing.
  197. # Removes the OPTIONS from the arguments. Sets the variables:
  198. # - force           1 if --force was given, 0 otherwise
  199. # - intldir         yes if --intl was given, empty otherwise
  200. # - podirs          list of directories specified with --po-dir
  201. # - try_ln_s        : if --symlink was given, false otherwise
  202. # - do_changelog    false if --no-changelog was given, : otherwise
  203. # - doit            false if --dry-run was given, : otherwise
  204. {
  205.   force=0
  206.   intldir=
  207.   podirs=
  208.   try_ln_s=false
  209.   do_changelog=:
  210.   doit=:
  211.  
  212.   while test $# -gt 0; do
  213.     case "$1" in
  214.       -c | --copy | --cop | --co | --c ) # accepted for backward compatibility
  215.         shift ;;
  216.       -n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d )
  217.         shift
  218.         doit=false ;;
  219.       -f | --force | --forc | --for | --fo | --f )
  220.         shift
  221.         force=1 ;;
  222.       --help | --hel | --he | --h )
  223.         func_usage; exit 0 ;;
  224.       --intl | --int | --in | --i )
  225.         shift
  226.         intldir=yes ;;
  227.       --po-dir | --po-di | --po-d | --po- | --po | --p )
  228.         shift 
  229.         if test $# = 0; then
  230.           func_fatal_error "missing argument for --po-dir"
  231.         fi
  232.         case "$1" in
  233.           -*) func_fatal_error "missing argument for --po-dir" ;;
  234.         esac
  235.         podirs="$podirs $1"
  236.         shift ;;
  237.       --po-dir=* )
  238.         arg=`echo "X$1" | sed -e 's/^X--po-dir=//'`
  239.         podirs="$podirs $arg"
  240.         shift ;;
  241.       --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
  242.         shift
  243.         do_changelog=false ;;
  244.       --symlink | --symlin | --symli | --syml | --sym | --sy | --s )
  245.         shift
  246.         try_ln_s=: ;;
  247.       --version | --versio | --versi | --vers | --ver | --ve | --v )
  248.         func_version
  249.         exit 0 ;;
  250.       -- )    # Stop option prcessing
  251.         shift; break ;;
  252.       -* )
  253.         echo "gettextize: unknown option $1" 1>&2
  254.         echo "Try 'gettextize --help' for more information." 1>&2
  255.         exit 1 ;;
  256.       * )
  257.         break ;;
  258.     esac
  259.   done
  260.   # podirs defaults to "po".
  261.   test -n "$podirs" || podirs="po"
  262. }
  263.  
  264. # Command-line argument processing.
  265. # Analyzes the remaining arguments.
  266. # Sets the variables
  267. # - origdir         to the original directory,
  268. # - srcdir          to the package directory, and cd-s into it.
  269. {
  270.   if test $# -gt 1; then
  271.     func_usage 1>&2
  272.     exit 1
  273.   fi
  274.   origdir=`pwd`
  275.   if test $# -eq 1; then
  276.     srcdir=$1
  277.     if cd "$srcdir"; then
  278.       srcdir=`pwd`
  279.     else
  280.       func_fatal_error "Cannot change directory to '$srcdir'."
  281.     fi
  282.   else
  283.     srcdir=$origdir
  284.   fi
  285. }
  286.  
  287. # The current directory is now $srcdir.
  288.  
  289. # Check integrity of package: A configure.in/ac must be present. Sets variable
  290. # - configure_in    name of configure.in/ac file.
  291. test -f configure.in || test -f configure.ac ||
  292.   func_fatal_error "Missing configure.in or configure.ac, please cd to your package first."
  293. configure_in=NONE
  294. if test -f configure.in; then
  295.   configure_in=configure.in
  296. else
  297.   if test -f configure.ac; then
  298.     configure_in=configure.ac
  299.   fi
  300. fi
  301.  
  302. # Check whether the --force option is needed but has not been specified.
  303. if test $force -eq 0; then
  304.   if test -d intl; then
  305.     func_fatal_error "intl/ subdirectory exists: use option -f if you really want to delete it."
  306.   fi
  307.   for podir in $podirs; do
  308.     if test -f "$podir/Makefile.in.in"; then
  309.       func_fatal_error "$podir/Makefile.in.in exists: use option -f if you really want to delete it."
  310.     fi
  311.   done
  312.   if test -f ABOUT-NLS; then
  313.     func_fatal_error "ABOUT-NLS exists: use option -f if you really want to delete it."
  314.   fi
  315. fi
  316.  
  317. # Check in which directory config.rpath etc. belong.
  318. auxdir=`cat "$configure_in" | grep '^AC_CONFIG_AUX_DIR' | sed -n -e 's/AC_CONFIG_AUX_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
  319. if test -n "$auxdir"; then
  320.   auxdir="$auxdir/"
  321. fi
  322.  
  323. # For simplicity we change to the gettext source directory.
  324. cd "$gettext_dir" ||
  325.   func_fatal_error "gettext source directory '${gettext_dir}' doesn't exist"
  326.  
  327. # Variables which keep track what has been modified.
  328. added_directories=
  329. removed_directory=
  330. added_extradist=
  331. added_acoutput=
  332. removed_acoutput=" intl/intlh.inst"
  333.  
  334. # Variable:
  335. # - please          accumulates instructions for the user.
  336. please=
  337.  
  338. # Variable:
  339. # - date            current date, for use in ChangeLog entries.
  340. date=`date +%Y-%m-%d`
  341.  
  342. # func_copy from to
  343. # copies a file.
  344. # 'from' is a relative pathname, relative to the current directory.
  345. # 'to' is a relative pathname, relative to $srcdir.
  346. func_copy ()
  347. {
  348.   if $doit; then
  349.     rm -f "$srcdir/$2"
  350.     echo "Copying file $2"
  351.     cp "$1" "$srcdir/$2"
  352.   else
  353.     echo "Copy file $2"
  354.   fi
  355. }
  356.  
  357. # func_linkorcopy from absfrom to
  358. # links or copies a file.
  359. # 'from' is a relative pathname, relative to the current directory.
  360. # 'absfrom' is the corresponding absolute pathname.
  361. # 'to' is a relative pathname, relative to $srcdir.
  362. func_linkorcopy ()
  363. {
  364.   if $doit; then
  365.     rm -f "$srcdir/$3"
  366.     ($try_ln_s && ln -s "$2" "$srcdir/$3" && echo "Symlinking file $3") 2>/dev/null ||
  367.     { echo "Copying file $3"; cp "$1" "$srcdir/$3"; }
  368.   else
  369.     if $try_ln_s; then
  370.       echo "Symlink file $3"
  371.     else
  372.       echo "Copy file $3"
  373.     fi
  374.   fi
  375. }
  376.  
  377. # func_backup to
  378. # makes a backup of a file that is about to be overwritten or replaced.
  379. # 'to' is a relative pathname, relative to $srcdir.
  380. func_backup ()
  381. {
  382.   if $doit; then
  383.     if test -f "$srcdir/$1"; then
  384.       rm -f "$srcdir/$1~"
  385.       cp -p "$srcdir/$1" "$srcdir/$1~"
  386.     fi
  387.   fi
  388. }
  389.  
  390. # func_remove to
  391. # removes a file.
  392. # 'to' is a relative pathname, relative to $srcdir.
  393. func_remove ()
  394. {
  395.   if $doit; then
  396.     echo "Removing $1"
  397.     rm -f "$srcdir/$1"
  398.   else
  399.     echo "Remove $1"
  400.   fi
  401. }
  402.  
  403. # func_ChangeLog_init
  404. # func_ChangeLog_add_entry line
  405. # func_ChangeLog_finish
  406. # manage the ChangeLog file, relative to $srcdir.
  407. func_ChangeLog_init ()
  408. {
  409.   modified_ChangeLog=
  410. }
  411. func_ChangeLog_add_entry ()
  412. {
  413.   if $doit; then
  414.     if test -z "$modified_ChangeLog"; then
  415.       echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/ChangeLog.tmp"
  416.       echo >> "$srcdir/ChangeLog.tmp"
  417.       modified_ChangeLog=yes
  418.     fi
  419.     echo "$1" >> "$srcdir/ChangeLog.tmp"
  420.   else
  421.     modified_ChangeLog=yes
  422.   fi
  423. }
  424. func_ChangeLog_finish ()
  425. {
  426.   if test -n "$modified_ChangeLog"; then
  427.     if $doit; then
  428.       echo >> "$srcdir/ChangeLog.tmp"
  429.       if test -f "$srcdir/ChangeLog"; then
  430.         echo "Adding an entry to ChangeLog (backup is in ChangeLog~)"
  431.         cat "$srcdir/ChangeLog" >> "$srcdir/ChangeLog.tmp"
  432.         rm -f "$srcdir/ChangeLog~"
  433.         cp -p "$srcdir/ChangeLog" "$srcdir/ChangeLog~"
  434.       else
  435.         echo "Creating ChangeLog"
  436.       fi
  437.       cp "$srcdir/ChangeLog.tmp" "$srcdir/ChangeLog"
  438.       rm -f "$srcdir/ChangeLog.tmp"
  439.     else
  440.       if test -f "$srcdir/ChangeLog"; then
  441.         echo "Add an entry to ChangeLog"
  442.       else
  443.         echo "Create ChangeLog"
  444.       fi
  445.     fi
  446.   fi
  447. }
  448.  
  449. # func_poChangeLog_init
  450. # func_poChangeLog_add_entry line
  451. # func_poChangeLog_finish
  452. # manage the $podir/ChangeLog file, relative to $srcdir.
  453. func_poChangeLog_init ()
  454. {
  455.   modified_poChangeLog=
  456. }
  457. func_poChangeLog_add_entry ()
  458. {
  459.   if $doit; then
  460.     if test -z "$modified_poChangeLog"; then
  461.       echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/$podir/ChangeLog.tmp"
  462.       echo >> "$srcdir/$podir/ChangeLog.tmp"
  463.       modified_poChangeLog=yes
  464.     fi
  465.     echo "$1" >> "$srcdir/$podir/ChangeLog.tmp"
  466.   else
  467.     modified_poChangeLog=yes
  468.   fi
  469. }
  470. func_poChangeLog_finish ()
  471. {
  472.   if test -n "$modified_poChangeLog"; then
  473.     if $doit; then
  474.       echo >> "$srcdir/$podir/ChangeLog.tmp"
  475.       if test -f "$srcdir/$podir/ChangeLog"; then
  476.         echo "Adding an entry to $podir/ChangeLog (backup is in $podir/ChangeLog~)"
  477.         cat "$srcdir/$podir/ChangeLog" >> "$srcdir/$podir/ChangeLog.tmp"
  478.         rm -f "$srcdir/$podir/ChangeLog~"
  479.         cp -p "$srcdir/$podir/ChangeLog" "$srcdir/$podir/ChangeLog~"
  480.       else
  481.         echo "Creating $podir/ChangeLog"
  482.       fi
  483.       cp "$srcdir/$podir/ChangeLog.tmp" "$srcdir/$podir/ChangeLog"
  484.       rm -f "$srcdir/$podir/ChangeLog.tmp"
  485.     else
  486.       if test -f "$srcdir/$podir/ChangeLog"; then
  487.         echo "Add an entry to $podir/ChangeLog"
  488.       else
  489.         echo "Create $podir/ChangeLog"
  490.       fi
  491.     fi
  492.   fi
  493. }
  494.  
  495. # func_m4ChangeLog_init
  496. # func_m4ChangeLog_add_entry line
  497. # func_m4ChangeLog_finish
  498. # manage the $m4dir/ChangeLog file, relative to $srcdir.
  499. func_m4ChangeLog_init ()
  500. {
  501.   if test -n "$using_m4ChangeLog"; then
  502.     modified_m4ChangeLog=
  503.     created_m4ChangeLog=
  504.   fi
  505. }
  506. func_m4ChangeLog_add_entry ()
  507. {
  508.   if test -n "$using_m4ChangeLog"; then
  509.     if $doit; then
  510.       if test -z "$modified_m4ChangeLog"; then
  511.         echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/$m4dir/ChangeLog.tmp"
  512.         echo >> "$srcdir/$m4dir/ChangeLog.tmp"
  513.         modified_m4ChangeLog=yes
  514.       fi
  515.       echo "$1" >> "$srcdir/$m4dir/ChangeLog.tmp"
  516.     else
  517.       modified_m4ChangeLog=yes
  518.     fi
  519.   else
  520.     line="$1"
  521.     line=`echo "$line" | sed -e "s%^    \\* %    * $m4dir/%"`
  522.     func_ChangeLog_add_entry "$line"
  523.   fi
  524. }
  525. func_m4ChangeLog_finish ()
  526. {
  527.   if test -n "$using_m4ChangeLog"; then
  528.     if test -n "$modified_m4ChangeLog"; then
  529.       if $doit; then
  530.         echo >> "$srcdir/$m4dir/ChangeLog.tmp"
  531.         if test -f "$srcdir/$m4dir/ChangeLog"; then
  532.           echo "Adding an entry to $m4dir/ChangeLog (backup is in $m4dir/ChangeLog~)"
  533.           cat "$srcdir/$m4dir/ChangeLog" >> "$srcdir/$m4dir/ChangeLog.tmp"
  534.           rm -f "$srcdir/$m4dir/ChangeLog~"
  535.           cp -p "$srcdir/$m4dir/ChangeLog" "$srcdir/$m4dir/ChangeLog~"
  536.         else
  537.           echo "Creating $m4dir/ChangeLog"
  538.           created_m4ChangeLog=yes
  539.         fi
  540.         cp "$srcdir/$m4dir/ChangeLog.tmp" "$srcdir/$m4dir/ChangeLog"
  541.         rm -f "$srcdir/$m4dir/ChangeLog.tmp"
  542.       else
  543.         if test -f "$srcdir/$m4dir/ChangeLog"; then
  544.           echo "Add an entry to $m4dir/ChangeLog"
  545.         else
  546.           echo "Create $m4dir/ChangeLog"
  547.           created_m4ChangeLog=yes
  548.         fi
  549.       fi
  550.     fi
  551.   fi
  552. }
  553. using_m4ChangeLog=yes
  554.  
  555. if test ! -f "$srcdir/intl/Makefile.in" && test -n "$intldir"; then
  556.   added_acoutput="$added_acoutput intl/Makefile"
  557. fi
  558. if test -f "$srcdir/intl/Makefile.in" && test -z "$intldir"; then
  559.   removed_acoutput="$removed_acoutput intl/Makefile"
  560. fi
  561. if test -d "$srcdir/intl"; then
  562.   # Remove everything inside intl except for RCS and CVS subdirs and invisible
  563.   # files.
  564.   if $doit; then
  565.     echo "Wiping out intl/ subdirectory"
  566.     (cd "$srcdir/intl" &&
  567.      for f in *; do
  568.        if test CVS != "$f" && test RCS != "$f"; then
  569.          rm -rf "$f"
  570.        fi
  571.      done)
  572.   else
  573.     echo "Wipe out intl/ subdirectory"
  574.   fi
  575.   if test -z "$intldir"; then
  576.     removed_directory=intl
  577.   fi
  578. else
  579.   if test -n "$intldir"; then
  580.     if $doit; then
  581.       echo "Creating intl/ subdirectory"
  582.       mkdir "$srcdir/intl" || func_fatal_error "failed to create intl/ subdirectory"
  583.     else
  584.       echo "Create intl/ subdirectory"
  585.     fi
  586.     added_directories="$added_directories intl"
  587.   fi
  588. fi
  589.  
  590. $do_changelog && func_ChangeLog_init
  591.  
  592. for podir in $podirs; do
  593.   test -d "$srcdir/$podir" || {
  594.     if $doit; then
  595.       echo "Creating $podir/ subdirectory"
  596.       mkdir "$srcdir/$podir" || func_fatal_error "failed to create $podir/ subdirectory"
  597.     else
  598.       echo "Create $podir/ subdirectory"
  599.     fi
  600.     added_directories="$added_directories $podir"
  601.   }
  602. done
  603.  
  604. # Create the directory for config.rpath, if needed.
  605. # This is for consistency with autoreconf and automake.
  606. # Note that $auxdir is either empty or ends in a slash.
  607. test -d "$srcdir/$auxdir" || {
  608.   if $doit; then
  609.     echo "Creating $auxdir subdirectory"
  610.     mkdir "$srcdir/$auxdir" || func_fatal_error "failed to create $auxdir subdirectory"
  611.   else
  612.     echo "Create $auxdir subdirectory"
  613.   fi
  614. }
  615.  
  616. # Now copy all files.  Take care for the destination directories.
  617. for file in *; do
  618.   case $file in
  619.     ABOUT-NLS)
  620.       func_linkorcopy $file "$gettext_dir/$file" $file
  621.       ;;
  622.     config.rpath)
  623.       if test -f "$srcdir/$auxdir$file"; then
  624.         :
  625.       else
  626.         added_extradist="$added_extradist $auxdir$file"
  627.       fi
  628.       func_linkorcopy $file "$gettext_dir/$file" "$auxdir$file"
  629.       ;;
  630.   esac
  631. done
  632.  
  633. # Copy files to intl/ subdirectory.
  634. if test -n "$intldir"; then
  635.   cd intl
  636.   for file in *; do
  637.     if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
  638.       if test $file != plural.c; then
  639.         func_linkorcopy $file "$gettext_dir/intl/$file" intl/$file
  640.       else
  641.         # plural.c is a generated file; it must be copied and touched.
  642.         func_copy $file intl/$file
  643.         if $doit; then
  644.           (sleep 2; touch "$srcdir/intl/$file") &
  645.         fi
  646.       fi
  647.     fi
  648.   done
  649.   cd ..
  650. else
  651.   echo "Not copying intl/ directory."
  652.   # Tell the user what to put into configure.ac, if it is not already there.
  653.   if grep '^AM_GNU_GETTEXT([[]\?external[]]\?[     ]*[,)]' "$srcdir/$configure_in" > /dev/null; then
  654.     :
  655.   else
  656.     please="$please
  657. Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration
  658. to look for an external libintl.
  659. "
  660.   fi
  661. fi
  662.  
  663. # Copy files to po/ subdirectory.
  664. cd po
  665. for podir in $podirs; do
  666.   $do_changelog && func_poChangeLog_init
  667.   for file in Makefile.in.in; do
  668.     same=no
  669.     if test -f "$srcdir/$podir/$file"; then
  670.       if cmp -s $file "$srcdir/$podir/$file"; then
  671.         same=yes
  672.       fi
  673.     else
  674.       added_acoutput="$added_acoutput $podir/Makefile.in"
  675.     fi
  676.     if $do_changelog && test $same = no; then
  677.       if test -f "$srcdir/$podir/$file"; then
  678.         func_poChangeLog_add_entry "    * $file: Upgrade to gettext-${version}."
  679.       else
  680.         func_poChangeLog_add_entry "    * $file: New file, from gettext-${version}."
  681.       fi
  682.     fi
  683.     func_backup "$podir/$file"
  684.     func_linkorcopy $file "$gettext_dir/po/$file" "$podir/$file"
  685.   done
  686.   for file in *; do
  687.     case $file in
  688.       Makefile.in.in)
  689.         # Already handled above.
  690.         ;;
  691.       Makevars.template)
  692.         func_linkorcopy Makevars.template "$gettext_dir/po/Makevars.template" "$podir/Makevars.template"
  693.         if test -f "$srcdir/po/Makevars"; then
  694.           LC_ALL=C sed -n -e 's/[     ]*\([A-Za-z0-9_]*\)[     ]*=.*/\1/p' < "$srcdir/$podir/Makevars" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp1"
  695.           LC_ALL=C sed -n -e 's/[     ]*\([A-Za-z0-9_]*\)[     ]*=.*/\1/p' < "$srcdir/$podir/Makevars.template" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp2"
  696.           missingvars=`LC_ALL=C comm -13 "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"`
  697.           rm -f "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"
  698.           if test -n "$missingvars"; then
  699.             please="$please
  700. Please update $podir/Makevars so that it defines all the variables mentioned
  701. in $podir/Makevars.template.
  702. You can then remove $podir/Makevars.template.
  703. "
  704.           fi
  705.         else
  706.           please="$please
  707. Please create $podir/Makevars from the template in $podir/Makevars.template.
  708. You can then remove $podir/Makevars.template.
  709. "
  710.         fi
  711.         ;;
  712.       *)
  713.         same=no
  714.         if test -f "$srcdir/$podir/$file"; then
  715.           if cmp -s $file "$srcdir/$podir/$file"; then
  716.             same=yes
  717.           fi
  718.         fi
  719.         if $do_changelog && test $same = no; then
  720.           if test -f "$srcdir/$podir/$file"; then
  721.             func_poChangeLog_add_entry "    * $file: Upgrade to gettext-${version}."
  722.           else
  723.             func_poChangeLog_add_entry "    * $file: New file, from gettext-${version}."
  724.           fi
  725.         fi
  726.         func_backup "$podir/$file"
  727.         func_linkorcopy $file "$gettext_dir/po/$file" "$podir/$file"
  728.         ;;
  729.     esac
  730.   done
  731.   if test -f "$srcdir/$podir/cat-id-tbl.c"; then
  732.     func_remove "$podir/cat-id-tbl.c"
  733.     $do_changelog && func_poChangeLog_add_entry "    * cat-id-tbl.c: Remove file."
  734.   fi
  735.   if test -f "$srcdir/$podir/stamp-cat-id"; then
  736.     func_remove "$podir/stamp-cat-id"
  737.     $do_changelog && func_poChangeLog_add_entry "    * stamp-cat-id: Remove file."
  738.   fi
  739.   if test ! -f "$srcdir/$podir/POTFILES.in"; then
  740.     if $doit; then
  741.       echo "Creating initial $podir/POTFILES.in"
  742.       echo '# List of source files which contain translatable strings.' > "$srcdir/$podir/POTFILES.in"
  743.     else
  744.       echo "Create initial $podir/POTFILES.in"
  745.     fi
  746.     $do_changelog && func_poChangeLog_add_entry "    * POTFILES.in: New file."
  747.     please="$please
  748. Please fill $podir/POTFILES.in as described in the documentation.
  749. "
  750.   fi
  751.   $do_changelog && func_poChangeLog_finish
  752. done
  753.  
  754. # Determine whether we can assume automake 1.9 or newer.
  755. have_automake19=
  756. if (aclocal --version) >/dev/null 2>/dev/null; then
  757.   aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
  758.   case $aclocal_version in
  759.     1.9* | 1.[1-9][0-9]* | [2-9]*) have_automake19=yes ;;
  760.   esac
  761. fi
  762.  
  763. m4filelist='gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4
  764.  po.m4 progtest.m4'
  765. # With aclocal versions < 1.9 we need all m4 files, otherwise "aclocal -I m4"
  766. # might give an error. (aclocal < 1.9 didn't know which macros are really
  767. # needed, it looked which macros are potentially needed.)
  768. min_automake_version=1.9
  769. if test -n "$intldir" || test -z "$have_automake19"; then
  770.   # Add intldir.m4, intl.m4 and its dependencies.
  771.   m4filelist=$m4filelist' codeset.m4 glibc2.m4 glibc21.m4 intdiv0.m4 intl.m4
  772.    intldir.m4 intlmacosx.m4 intmax.m4 inttypes_h.m4 inttypes-pri.m4
  773.    lcmessage.m4 lock.m4 longlong.m4 printf-posix.m4 size_max.m4 stdint_h.m4
  774.    uintmax_t.m4 visibility.m4 wchar_t.m4 wint_t.m4 xsize.m4'
  775.   min_automake_version=1.8
  776. fi
  777.  
  778. # All sorts of bugs could occur if the configure file was remade with the wrong
  779. # version of gettext.m4 et al. (because then the configure and the po/Makefile.in.in
  780. # don't fit together). It is therefore important that the package carries the
  781. # right versions of gettext.m4 et al. with it.
  782. if test -f "$srcdir/Makefile.am"; then
  783.   # A package using automake.
  784.  
  785.   # Determine whether it's using automake 1.8 or newer.
  786.   have_automake18=
  787.   if (aclocal --version) >/dev/null 2>/dev/null; then
  788.     aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
  789.     case $aclocal_version in
  790.       1.[8-9]* | 1.[1-9][0-9]* | [2-9]*) have_automake18=yes ;;
  791.     esac
  792.   fi
  793.  
  794.   # Extract the macro directory name from Makefile.am.
  795.   aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[     ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[     ]*=\(.*\)$/\1/'`
  796.   m4dir=m4
  797.   m4dir_defaulted=yes
  798.   m4dir_is_next=
  799.   for arg in $aclocal_amflags; do
  800.     if test -n "$m4dir_is_next"; then
  801.       # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
  802.       case "$arg" in
  803.         /*) ;;
  804.         *)
  805.           m4dir="$arg"
  806.           m4dir_defaulted=
  807.           break
  808.           ;;
  809.       esac
  810.       m4dir_is_next=
  811.     else
  812.       if test "X$arg" = "X-I"; then
  813.         m4dir_is_next=yes
  814.       else
  815.         m4dir_is_next=
  816.       fi
  817.     fi
  818.   done
  819.  
  820.   # Decide whether to use $m4dir/ChangeLog, or to use ChangeLog instead.
  821.   if test -d "$srcdir/$m4dir" && test -f "$srcdir/ChangeLog" && test ! -f "$srcdir/$m4dir/ChangeLog"; then
  822.     # The programmer has no $m4dir/ChangeLog so far. Don't introduce one.
  823.     using_m4ChangeLog=
  824.   fi
  825.  
  826.   # Update the *.m4 files and the corresponding Makefile.am.
  827.   $do_changelog && func_m4ChangeLog_init
  828.   added_m4dir=
  829.   added_m4files=
  830.   if test -d "$srcdir/$m4dir"; then
  831.     :
  832.   else
  833.     if $doit; then
  834.       echo "Creating directory $m4dir"
  835.       mkdir "$srcdir/$m4dir"
  836.     else
  837.       echo "Create directory $m4dir"
  838.     fi
  839.     added_m4dir=yes
  840.   fi
  841.   for file in $m4filelist; do
  842.     same=no
  843.     if test -f "$srcdir/$m4dir/$file"; then
  844.       if cmp -s "${datarootdir}/aclocal/$file" "$srcdir/$m4dir/$file"; then
  845.         same=yes
  846.       fi
  847.     else
  848.       added_m4files="$added_m4files $file"
  849.     fi
  850.     if $do_changelog && test $same = no; then
  851.       if test -f "$srcdir/$m4dir/$file"; then
  852.         func_m4ChangeLog_add_entry "    * $file: Upgrade to gettext-${version}."
  853.       else
  854.         func_m4ChangeLog_add_entry "    * $file: New file, from gettext-${version}."
  855.       fi
  856.     fi
  857.     func_backup "$m4dir/$file"
  858.     func_linkorcopy "${datarootdir}/aclocal/$file" "${datarootdir}/aclocal/$file" "$m4dir/$file"
  859.   done
  860.   missing_m4Makefileam=
  861.   if test -n "$added_m4files"; then
  862.     if test -f "$srcdir/$m4dir/Makefile.am"; then
  863.       if $doit; then
  864.         echo "Updating EXTRA_DIST in $m4dir/Makefile.am (backup is in $m4dir/Makefile.am~)"
  865.         func_backup "$m4dir/Makefile.am"
  866.         rm -f "$srcdir/$m4dir/Makefile.am"
  867.         if grep '^EXTRA_DIST[     ]*=' "$srcdir/$m4dir/Makefile.am~" > /dev/null; then
  868.           sed -e "s%^\(EXTRA_DIST[     ]*=\) \\?%\\1$added_m4files %" < "$srcdir/$m4dir/Makefile.am~" > "$srcdir/$m4dir/Makefile.am"
  869.           $do_changelog && func_m4ChangeLog_add_entry "    * Makefile.am (EXTRA_DIST): Add the new files."
  870.         else
  871.           (cat "$srcdir/$m4dir/Makefile.am~"; echo; echo "EXTRA_DIST =$added_m4files") > "$srcdir/$m4dir/Makefile.am"
  872.           $do_changelog && func_m4ChangeLog_add_entry "    * Makefile.am (EXTRA_DIST): New variable."
  873.         fi
  874.       else
  875.         echo "Update EXTRA_DIST in $m4dir/Makefile.am"
  876.         $do_changelog && func_m4ChangeLog_add_entry "    * Makefile.am (EXTRA_DIST)."
  877.       fi
  878.     else
  879.       # $m4dir/Makefile.am is not needed any more when aclocal 1.8 or newer
  880.       # is used.
  881.       if test -z "$have_automake18"; then
  882.         if $doit; then
  883.           echo "Creating $m4dir/Makefile.am"
  884.           echo "EXTRA_DIST =$added_m4files" > "$srcdir/$m4dir/Makefile.am"
  885.         else
  886.           echo "Create $m4dir/Makefile.am"
  887.         fi
  888.         $do_changelog && func_m4ChangeLog_add_entry "    * Makefile.am: New file."
  889.         added_acoutput="$added_acoutput $m4dir/Makefile"
  890.       else
  891.         missing_m4Makefileam=yes
  892.       fi
  893.     fi
  894.   fi
  895.   if test -n "$added_m4dir" && test -z "$missing_m4Makefileam"; then
  896.     added_directories="$added_directories $m4dir"
  897.   fi
  898.   $do_changelog && func_m4ChangeLog_finish
  899.   # automake will arrange for $m4dir/ChangeLog to be distributed if a
  900.   # $m4dir/Makefile.am exists. If not, we need to add it to Makefile.am's
  901.   # EXTRA_DIST explicitly.
  902.   if test -n "$created_m4ChangeLog" && test -n "$missing_m4Makefileam"; then
  903.     added_extradist="$added_extradist $m4dir/ChangeLog"
  904.   fi
  905.  
  906.   # Update the top-level Makefile.am.
  907.   modified_Makefile_am=
  908.   # func_modify_Makefile_am changelog_comment
  909.   # assumes a modified copy of $srcdir/Makefile.am in $srcdir/Makefile.am.tmp
  910.   # and replaces the original Makefile.am file with the modified one if
  911.   # the two files differ. Then it removes the modified copy.
  912.   func_modify_Makefile_am ()
  913.   {
  914.     if cmp -s "$srcdir/Makefile.am" "$srcdir/Makefile.am.tmp"; then
  915.       :
  916.     else
  917.       if test -z "$modified_Makefile_am"; then
  918.         if $doit; then
  919.           echo "Updating Makefile.am (backup is in Makefile.am~)"
  920.           func_backup Makefile.am
  921.         else
  922.           echo "Update Makefile.am"
  923.         fi
  924.       fi
  925.       if $doit; then
  926.         rm -f "$srcdir/Makefile.am"
  927.         cp "$srcdir/Makefile.am.tmp" "$srcdir/Makefile.am"
  928.       fi
  929.       if $do_changelog; then
  930.         if test -z "$modified_Makefile_am"; then
  931.           func_ChangeLog_add_entry "    * Makefile.am $1"
  932.         else
  933.           func_ChangeLog_add_entry "    $1"
  934.         fi
  935.       fi
  936.       modified_Makefile_am=yes
  937.     fi
  938.     rm -f "$srcdir/Makefile.am.tmp"
  939.   }
  940.  
  941.   if test -n "$added_directories"; then
  942.     if grep '^SUBDIRS[     ]*=' "$srcdir/Makefile.am" > /dev/null; then
  943.       sed -e "s%^\(SUBDIRS[     ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  944.       added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
  945.       func_modify_Makefile_am "(SUBDIRS): Add $added_directories_pretty."
  946.     else
  947.       (cat "$srcdir/Makefile.am"; echo; echo "SUBDIRS =$added_directories") > "$srcdir/Makefile.am.tmp"
  948.       func_modify_Makefile_am "(SUBDIRS): New variable."
  949.     fi
  950.   fi
  951.   if test -n "$removed_directory"; then
  952.     sed -e '/^SUBDIRS[     ]*=/ {
  953.         :a
  954.         s%\([     ]\)'"$removed_directory"'[     ]%\1%
  955.         s%[     ]'"$removed_directory"'$%%
  956.         tb
  957.         :b
  958.         s%\\$%\\%
  959.         tc
  960.         bd
  961.         :c
  962.         n
  963.         ba
  964.       :d
  965.     }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  966.     func_modify_Makefile_am "(SUBDIRS): Remove $removed_directory."
  967.   fi
  968.   if test -n "$added_directories"; then
  969.     if grep '^DIST_SUBDIRS[     ]*=' "$srcdir/Makefile.am" > /dev/null; then
  970.       sed -e "s%^\(DIST_SUBDIRS[     ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  971.       added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
  972.       func_modify_Makefile_am "(DIST_SUBDIRS): Add $added_directories_pretty."
  973.     fi
  974.   fi
  975.   if test -n "$removed_directory"; then
  976.     sed -e '/^DIST_SUBDIRS[     ]*=/ {
  977.         :a
  978.         s%\([     ]\)'"$removed_directory"'[     ]%\1%
  979.         s%[     ]'"$removed_directory"'$%%
  980.         tb
  981.         :b
  982.         s%\\$%\\%
  983.         tc
  984.         bd
  985.         :c
  986.         n
  987.         ba
  988.       :d
  989.     }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  990.     func_modify_Makefile_am "(DIST_SUBDIRS): Remove $removed_directory."
  991.   fi
  992.   if test -n "$m4dir_defaulted"; then
  993.     if grep '^ACLOCAL_AMFLAGS[     ]*=' "$srcdir/Makefile.am" > /dev/null; then
  994.       sed -e "s%^\(ACLOCAL_AMFLAGS[     ]*=\) \\?%\\1 -I $m4dir %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  995.       func_modify_Makefile_am "(ACLOCAL_AMFLAGS): Add -I $m4dir."
  996.     else
  997.       (cat "$srcdir/Makefile.am"; echo; echo "ACLOCAL_AMFLAGS = -I $m4dir") > "$srcdir/Makefile.am.tmp"
  998.       func_modify_Makefile_am "(ACLOCAL_AMFLAGS): New variable."
  999.     fi
  1000.     # Also update Makefile.in and, if existent, Makefile. Otherwise they
  1001.     # would take into account the new flags only after a few rounds of
  1002.     # "./configure", "make", "touch configure.in", "make distclean".
  1003.     if $doit; then
  1004.       for file in Makefile.in Makefile; do
  1005.         if test -f "$srcdir/$file"; then
  1006.           func_backup $file
  1007.           rm -f "$srcdir/$file"
  1008.           sed -e "s%(ACLOCAL)%(ACLOCAL) -I $m4dir%" < "$srcdir/$file~" > "$srcdir/$file"
  1009.         fi
  1010.       done
  1011.     fi
  1012.   fi
  1013.   if test -n "$added_extradist"; then
  1014.     if grep '^EXTRA_DIST[     ]*=' "$srcdir/Makefile.am" > /dev/null; then
  1015.       sed -e "s%^\(EXTRA_DIST[     ]*=\)%\\1$added_extradist %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  1016.       added_extradist_pretty=`echo $added_extradist | sed -e 's/ /, /g'`
  1017.       func_modify_Makefile_am "(EXTRA_DIST): Add $added_extradist_pretty."
  1018.     else
  1019.       (cat "$srcdir/Makefile.am"; echo; echo "EXTRA_DIST =$added_extradist") > "$srcdir/Makefile.am.tmp"
  1020.       func_modify_Makefile_am "(EXTRA_DIST): New variable."
  1021.     fi
  1022.   fi
  1023.   # Extract the aclocal options name from Makefile.am.
  1024.   aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[     ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[     ]*=\(.*\)$/\1/'`
  1025.   aclocal_options=
  1026.   m4dir_is_next=
  1027.   for arg in $aclocal_amflags; do
  1028.     if test -n "$m4dir_is_next"; then
  1029.       aclocal_options="$aclocal_options -I $arg"
  1030.       m4dir_is_next=
  1031.     else
  1032.       if test "X$arg" = "X-I"; then
  1033.         m4dir_is_next=yes
  1034.       else
  1035.         m4dir_is_next=
  1036.       fi
  1037.     fi
  1038.   done
  1039.   please="$please
  1040. Please run 'aclocal$aclocal_options' to regenerate the aclocal.m4 file.
  1041. You need aclocal from GNU automake $min_automake_version (or newer) to do this.
  1042. Then run 'autoconf' to regenerate the configure file.
  1043. "
  1044.  
  1045.   # Also create $m4dir/Makefile.in from $m4dir/Makefile.am, because automake
  1046.   # doesn't do it by itself.
  1047.   if $doit; then
  1048.     case "$added_acoutput" in
  1049.       *" $m4dir/Makefile")
  1050.         (cd "$srcdir" && automake "$m4dir/Makefile") 2>/dev/null ||
  1051.         please="$please
  1052. Please run 'automake $m4dir/Makefile' to create $m4dir/Makefile.in
  1053. "
  1054.         ;;
  1055.     esac
  1056.   fi
  1057. else
  1058.   please="$please
  1059. Please add the files
  1060. $m4filelist
  1061. from the ${datarootdir}/aclocal directory to your aclocal.m4 file.
  1062. "
  1063. fi
  1064.  
  1065. modified_configure_in=
  1066. # func_modify_configure_in changelog_comment
  1067. # assumes a modified copy of $srcdir/$configure_in in $srcdir/$configure_in.tmp
  1068. # and replaces the original configure.in/ac file with the modified one if
  1069. # the two files differ. Then it removes the modified copy.
  1070. func_modify_configure_in ()
  1071. {
  1072.   if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1073.     :
  1074.   else
  1075.     if test -z "$modified_configure_in"; then
  1076.       if $doit; then
  1077.         echo "Updating $configure_in (backup is in $configure_in~)"
  1078.         func_backup $configure_in
  1079.       else
  1080.         echo "Update $configure_in"
  1081.       fi
  1082.     fi
  1083.     if $doit; then
  1084.       rm -f "$srcdir/$configure_in"
  1085.       cp "$srcdir/$configure_in.tmp" "$srcdir/$configure_in"
  1086.     fi
  1087.     if $do_changelog; then
  1088.       if test -z "$modified_configure_in"; then
  1089.         func_ChangeLog_add_entry "    * $configure_in $1"
  1090.       else
  1091.         func_ChangeLog_add_entry "    $1"
  1092.       fi
  1093.     fi
  1094.     modified_configure_in=yes
  1095.   fi
  1096.   rm -f "$srcdir/$configure_in.tmp"
  1097. }
  1098.  
  1099. if test -n "$added_acoutput"; then
  1100.   if grep '^AC_CONFIG_FILES(' "$srcdir/$configure_in" > /dev/null; then
  1101.     sedprog='
  1102. ta
  1103. b
  1104. :a
  1105. n
  1106. ba'
  1107.     sed -e "s%^\\(AC_CONFIG_FILES([^])\\,]*\\)%\\1$added_acoutput%$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1108.     added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
  1109.     func_modify_configure_in "(AC_CONFIG_FILES): Add $added_acoutput_pretty."
  1110.   else
  1111.     if grep '^AC_OUTPUT(' "$srcdir/$configure_in" > /dev/null; then
  1112.       sed -e "s%^\\(AC_OUTPUT([^])\\,]*\\)%\\1$added_acoutput%" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1113.       added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
  1114.       func_modify_configure_in "(AC_OUTPUT): Add $added_acoutput_pretty."
  1115.     else
  1116.       please="$please
  1117. Please add$added_acoutput to the AC_OUTPUT or AC_CONFIG_FILES invocation in the $configure_in file.
  1118. "
  1119.     fi
  1120.   fi
  1121. fi
  1122. if test -n "$removed_acoutput"; then
  1123.   for file in $removed_acoutput; do
  1124.     tag=
  1125.     sedprog='{
  1126.       s%\([[     ]\)'"$file"'[     ]%\1%
  1127.       s%\([[     ]\)'"$file"'\([]),]\)%\1\2%
  1128.       s%[[     ]'"$file"'$%%
  1129.         :a
  1130.         tb
  1131.         :b
  1132.         s%\\$%\\%
  1133.         tc
  1134.         bd
  1135.         :c
  1136.         n
  1137.         s%\([     ]\)'"$file"'[     ]%\1%
  1138.         s%\([     ]\)'"$file"'\([]),]\)%\1\2%
  1139.         s%[     ]'"$file"'$%%
  1140.         ba
  1141.       :d
  1142.     }'
  1143.     sed -e '/^AC_CONFIG_FILES(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1144.     if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1145.       sed -e '/^AC_OUTPUT(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1146.       if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1147.         :
  1148.       else
  1149.         tag=AC_OUTPUT
  1150.       fi
  1151.     else
  1152.       tag=AC_CONFIG_FILES
  1153.     fi
  1154.     if test -n "$tag"; then
  1155.       func_modify_configure_in "($tag): Remove $file."
  1156.     else
  1157.       rm -f "$srcdir/$configure_in.tmp"
  1158.       if test "$file" != intl/intlh.inst; then
  1159.         please="$please
  1160. Please remove $file from the AC_OUTPUT or AC_CONFIG_FILES invocation
  1161. in the $configure_in file.
  1162. "
  1163.       fi
  1164.     fi
  1165.   done
  1166. fi
  1167. sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *%%' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1168. func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile."
  1169. sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1170. func_modify_configure_in "(AC_LINK_FILES): Remove invocation."
  1171. sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1172. func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $version."
  1173. $do_changelog && func_ChangeLog_finish
  1174.  
  1175. # Recommend replacement for deprecated Makefile variables.
  1176. use_libtool=`cat "$srcdir/$configure_in" | grep '^A[CM]_PROG_LIBTOOL'`
  1177. for file in `(cd "$srcdir"; find . -name Makefile.am -print; find . -name Makefile.in -print) | sed -e 's,^\./,,'`; do
  1178.   if test -f "$srcdir/$file"; then
  1179.     if test `echo "$file" | sed -e 's,^.*/,,'` = Makefile.in && grep automake "$srcdir/$file" >/dev/null 2>&1; then
  1180.       continue;
  1181.     fi
  1182.     # INTLLIBS is deprecated because it doesn't distinguish the two
  1183.     # cases: with libtool, without libtool.
  1184.     if grep '@''INTLLIBS''@' "$srcdir/$file" >/dev/null 2>&1; then
  1185.       if test -n "$use_libtool"; then
  1186.         please="$please
  1187. Please change $file to use @""LTLIBINTL""@ or @""LIBINTL""@ instead of
  1188. @""INTLLIBS""@. Which one, depends whether it is used with libtool or not.
  1189. @""INTLLIBS""@ will go away.
  1190. "
  1191.       else
  1192.         please="$please
  1193. Please change $file to use @""LIBINTL""@ instead of @""INTLLIBS""@.
  1194. @""INTLLIBS""@ will go away.
  1195. "
  1196.       fi
  1197.     fi
  1198.     # DATADIRNAME is deprecated because we install only .gmo files nowadays,
  1199.     # which can be stored in the platform independent $prefix/share hierarchy.
  1200.     if grep '@''DATADIRNAME''@' "$srcdir/$file" >/dev/null 2>&1; then
  1201.       please="$please
  1202. Please change $file to use the constant string \"share\" instead of
  1203. @""DATADIRNAME""@. @""DATADIRNAME""@ will go away.
  1204. "
  1205.     fi
  1206.     # INSTOBJEXT is deprecated because we install only .gmo files nowadays,
  1207.     # no catgets .cat catalogs.
  1208.     if grep '@''INSTOBJEXT''@' "$srcdir/$file" >/dev/null 2>&1; then
  1209.       please="$please
  1210. Please change $file to use the constant string \".mo\" instead of
  1211. @""INSTOBJEXT""@. @""INSTOBJEXT""@ will go away.
  1212. "
  1213.     fi
  1214.     # GENCAT is deprecated because we install no catgets catalogs anymore.
  1215.     if grep '@''GENCAT''@' "$srcdir/$file" >/dev/null 2>&1; then
  1216.       please="$please
  1217. Please change $file to use the constant string \"gencat\" instead of
  1218. @""GENCAT""@. @""GENCAT""@ will go away. Maybe you don't even need it any more?
  1219. "
  1220.     fi
  1221.     # POSUB is deprecated because it causes "./configure --disable-nls", "make",
  1222.     # "make dist" to create a buggy tarfile.
  1223.     if grep '@''POSUB''@' "$srcdir/$file" >/dev/null 2>&1; then
  1224.       please="$please
  1225. Please change $file to use the constant string \"po\" instead of
  1226. @""POSUB""@. @""POSUB""@ will go away.
  1227. "
  1228.     fi
  1229.   fi
  1230. done
  1231.  
  1232. # Recommend replacement for deprecated configure variables.
  1233. if grep '\$nls_cv_header_' "$srcdir/$configure_in" >/dev/null 2>&1; then
  1234.   please="$please
  1235. Please stop using \$nls_cv_header_intl or \$nls_cv_header_libgt in the
  1236. $configure_in file. Both will go away. Use <libintl.h> or \"gettext.h\" instead.
  1237. "
  1238. fi
  1239.  
  1240. # Recommend fetching config.guess and config.sub.
  1241. if test -f "$srcdir/$auxdir"config.guess && test -f "$srcdir/$auxdir"config.sub; then
  1242.   :
  1243. else
  1244.   please="$please
  1245. You will also need config.guess and config.sub, which you can get from the CVS
  1246. of the 'config' project at http://savannah.gnu.org/. The commands to fetch them
  1247. are
  1248. \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess'
  1249. \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub'
  1250. "
  1251. fi
  1252.  
  1253. if $doit; then
  1254.   echo "$please"
  1255.   echo "You might also want to copy the convenience header file gettext.h"
  1256.   echo "from the $gettext_dir directory into your package."
  1257.   echo "It is a wrapper around <libintl.h> that implements the configure --disable-nls"
  1258.   echo "option."
  1259.   echo
  1260.   count=`echo "$please" | grep '^$' | wc -l`
  1261.   count=`echo "$count" | sed -e 's/[     ]//g'`
  1262.   case "$count" in
  1263.     1) count="paragraph";;
  1264.     2) count="two paragraphs";;
  1265.     3) count="three paragraphs";;
  1266.     4) count="four paragraphs";;
  1267.     5) count="five paragraphs";;
  1268.     *) count="$count paragraphs";;
  1269.   esac
  1270.   echo "Press Return to acknowledge the previous $count."
  1271.   # Read from /dev/tty, not stdin, so that gettextize cannot be abused by
  1272.   # non-interactive tools.
  1273.   read dummy < /dev/tty
  1274. fi
  1275.  
  1276. exit 0
  1277.